package com.winner.data.util;


import java.util.TreeMap;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * fastjson为value为null也打印
 *
 * @author wangxinle5
 * @since 2022/04/25
 */
public class JsonUtil {


    public static void main(String[] args) {
        TreeMap<Object, Object> objectObjectTreeMap = new TreeMap<>();
        objectObjectTreeMap.put("key1", null);
        objectObjectTreeMap.put("key2", "sino");
        String jsonString = JSON.toJSONString(objectObjectTreeMap, SerializerFeature.WriteMapNullValue);
        System.out.println(jsonString);
    }

}
